class Solution {
public:
    vector<int> xorQueries(vector<int>& arr, vector<vector<int>>& queries) {
        vector<int> xorArr(arr.size() + 1, 0);
        for (int i = 1; i <= arr.size(); ++i) {
            xorArr[i] = xorArr[i - 1] ^ arr[i - 1];
        }
        vector<int> res;
        for (auto& it : queries) {
            res.emplace_back(xorArr[it[1] + 1] ^ xorArr[it[0]]);
        }
        return res;
    }
};